﻿#region Usings
using System.Web;
using BK.Model;
#endregion

namespace BK.Web.UI.AppCode
{
	public static class AppHelper
	{
		#region Class Properties
		public static string ContentRoot
		{
			get
			{
				const string CONTENT_VIRTUAL_ROOT = "~/Content";
				return VirtualPathUtility.ToAbsolute(CONTENT_VIRTUAL_ROOT);
			}
		}

		private static string CssRoot
		{
			get { return string.Format("{0}/{1}", ContentRoot, "Css"); }
		}

	    private static string JScriptRoot
	    {
            get { return string.Format("{0}/{1}", ContentRoot, "Scripts"); }
	    }

		public static User CurrentUser
		{
			get
			{
				User user = (User) CurrentContext.Session[Constants.SessionKeys.CURRENT_USER];
				return user;
			}
			set { CurrentContext.Session[Constants.SessionKeys.CURRENT_USER] = value; }
		}

		public static string ImageRoot
		{
			get { return string.Format("{0}/{1}", ContentRoot, "Images"); }
		}

		private static HttpContext CurrentContext
		{
			get { return HttpContext.Current; }
		}
		#endregion

		#region Class Methods
		public static string CssUrl(string cssFile)
		{
			string result = string.Format("{0}/{1}", CssRoot, cssFile);
			return result;
		}

		public static string ImageUrl(string imageFile)
		{
			string result = string.Format("{0}/{1}", ImageRoot, imageFile);
			return result;
		}
		#endregion
	}
}